
<div style="padding:20px">
<div style="font-size:25pt" class="cfont2">Settings</div><br>
<!-- subscription to groups -->

<?php

$result = mysql_query("SELECT * FROM site_group_members WHERE `fbid`='$user' AND `del`!='1'");
	if(!$result) echo mysql_error();
	

if(mysql_numrows($result)!=0)
{
	echo '<div id="gpsub_settings" style="padding:10px;border:1px solid #ddd">';
 echo '<div><strong>Subscription to Groups</strong></div><br>';

while($row = mysql_fetch_array($result))
{
	$gpid = $row['gpid'];
	//$gpname = mysql_result(mysql_query("SELECT * FROM site_groups WHERE `id`='$gpid'"),0,'name');
	$subscribed = mysql_numrows(mysql_query("SELECT * FROM site_subscribe WHERE `fbid`='$user' AND `gpid`='$gpid' AND `del`='1'"));
	
	?>
		<div style="float:left;width:350px"> 
		<?php  fetch_gp_details($gpid, "short"); ?>
		</div>
		<div style="float:left;width:200px">
			<form onsubmit='return false;'>
				<select id="gpsub_<?php echo $gpid; ?>">
					<option value="0" >No</option>
					<option value="1" <?php if($subscribed == 0) echo 'selected="selected"';?> >Yes</option>
				</select>
				<input type="submit" value="save" onclick='save_settings(this,"sub")'/>
			</form>
		</div>
		<div class="clear"></div>	
	<?php
}

echo '</div>';
}

echo '</div>';
?>
